#include <string.h>
#include <time.h>
#include "Task.h"

Task::Task() {
	this->prev = this->next = NULL;
	this->id = NULL;
	this->timestamp = time(NULL);
	this->threads = 1;	// 1 thread by default, if cpu is over taxed this count can be reduced to zero

	// set default values
	this->isLoaded = false;
	this->num_details = 0;
	this->isDrone = this->isDroneAssigned = false;
	this->isShutdown = false;

	// initialize drone thread handle as null
	this->drone_handle = NULL;
	this->drone_id = 0;
}

// Deconstructor
Task::~Task() {
	if(this->id) {
		free(this->id);
	}
	if(this->drone_handle) {
		CloseHandle(this->drone_handle);
	}
}